package com.dhl.segregation.improve;


/**
 * @title: SegregationImprove
 * @Author danghailiang
 * @Date: 2022/7/25 10:32
 * @Version 1.0
 */
public class SegregationImprove {
    public static void main(String[] args) {

        A a = new A();
        a.method1(new D());
        a.method2(new D());
        a.method3(new D());
        C c = new C();
        c.method1(new B());
        c.method4(new B());
        c.method5(new B());
    }
}
interface InterfaceImprove{
    void method1();


}
interface Interface2{
    void method2();
    void method3();
}
interface Interface3{
    void method4();
    void method5();
}
class D implements InterfaceImprove, Interface2{

    @Override
    public void method1() {
        System.out.println("method1");
    }

    @Override
    public void method2() {
        System.out.println("method2");
    }

    @Override
    public void method3() {
        System.out.println("method3");
    }

}

class B implements InterfaceImprove, Interface3 {

    @Override
    public void method1() {
        System.out.println("method1");
    }

    @Override
    public void method4() {
        System.out.println("method4");
    }

    @Override
    public void method5() {
        System.out.println("method5");
    }
}
class A{

    public void method1(D i ) {
        i.method1();
    }


    public void method2(D i ) {
        i.method2();
    }


    public void method3(D i ) {
        i.method3();
    }
}
class C{

    public void method1(B i ) {
        i.method1();
    }


    public void method4(B i ) {
        i.method4();
    }


    public void method5(B i ) {
        i.method5();
    }
}